package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.UserCouponApi;
import com.nbsaas.boot.marketing.data.entity.UserCoupon;
import com.nbsaas.boot.marketing.api.domain.request.UserCouponRequest;
import com.nbsaas.boot.marketing.api.domain.response.UserCouponResponse;
import com.nbsaas.boot.marketing.api.domain.simple.UserCouponSimple;
import com.nbsaas.boot.marketing.rest.convert.UserCouponSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.UserCouponEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.UserCouponResponseConvert;
import com.nbsaas.boot.marketing.data.repository.UserCouponRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   用户优惠券-业务接口实现
*/
@Transactional
@Service
public class UserCouponResource extends BaseResource<UserCoupon,UserCouponResponse, UserCouponSimple, UserCouponRequest>  implements UserCouponApi {

    @Resource
    private UserCouponRepository userCouponRepository;

    @Override
    public JpaRepositoryImplementation<UserCoupon, Serializable> getJpaRepository() {
        return userCouponRepository;
    }

    @Override
    public Function<UserCoupon, UserCouponSimple> getConvertSimple() {
        return new UserCouponSimpleConvert();
    }

    @Override
    public Function<UserCouponRequest, UserCoupon> getConvertForm() {
        return new UserCouponEntityConvert();
    }

    @Override
    public Function<UserCoupon, UserCouponResponse> getConvertResponse() {
        return new UserCouponResponseConvert();
    }




}


